package com.greenold.Appointment.service.impl;

import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.greenold.Appointment.mapper.AppointmentMapper;
import com.greenold.Appointment.domain.Appointment;
import com.greenold.Appointment.service.IAppointmentService;

/**
 * 预约登记Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-10-13
 */
@Service
public class AppointmentServiceImpl implements IAppointmentService 
{
    @Autowired
    private AppointmentMapper appointmentMapper;
    /**
     * 根据userId改变取消次数的值（extend1）
     */
    @Override
    public Integer updateCancelCountByUserId(String userId) {
        return appointmentMapper.updateCancelCountByUserId(userId);
    }
    /**
     * 根据userId查询取消次数（extend1）
     */
    @Override
    public Integer selectCancelCountByUserId(String userId) {
        return appointmentMapper.selectCancelCountByUserId(userId);
    }
    /**
     * 根据userId查询更新日期（updatedAt）
     */
    @Override
    public Date selectUpdatedAtByUserId(String userId) {
        return appointmentMapper.selectUpdatedAtByUserId(userId);
    }
    /**
     * 根据userId清空取消次数（extend1）
     */
    @Override
    public void updateCancelCountToZero() {
        appointmentMapper.updateCancelCountToZero();
    }
    /**
     * 查询预约登记
     * 
     * @param id 预约登记主键
     * @return 预约登记
     */
    @Override
    public Appointment selectAppointmentById(String id)
    {
        return appointmentMapper.selectAppointmentById(id);
    }
    /**根据传入的手机号查询预约表中是否有记录
     * */
    @Override
    public Integer selectAppointmentByMobile(String mobile) {
        return appointmentMapper.selectAppointmentByMobile(mobile);
    }
    /**
     * 根据传入的手机号查询绑定的老人姓名
     * */
    @Override
    public List<String> selectElderNameByUserId(String userId) {
        return appointmentMapper.selectElderNameByUserId(userId);
    }
    /**
     * 根据传入的日期查询预约登记列表数量
     * */
    @Override
    public Integer selectAppointmentCountByDate(String date) {
        return appointmentMapper.selectAppointmentCountByDate(date);
    }

    /**
     * 查询预约登记列表
     * 
     * @param appointment 预约登记
     * @return 预约登记
     */
    @Override
    public List<Appointment> selectAppointmentList(Appointment appointment)
    {
        return appointmentMapper.selectAppointmentList(appointment);
    }

    /**
     * 新增预约登记
     * 
     * @param appointment 预约登记
     * @return 结果
     */
    @Override
    public int insertAppointment(Appointment appointment)
    {
        return appointmentMapper.insertAppointment(appointment);
    }

    /**
     * 修改预约登记
     * 
     * @param appointment 预约登记
     * @return 结果
     */
    @Override
    public int updateAppointment(Appointment appointment)
    {
        return appointmentMapper.updateAppointment(appointment);
    }

    /**
     * 批量删除预约登记
     * 
     * @param ids 需要删除的预约登记主键
     * @return 结果
     */
    @Override
    public int deleteAppointmentByIds(String[] ids)
    {
        return appointmentMapper.deleteAppointmentByIds(ids);
    }

    /**
     * 删除预约登记信息
     * 
     * @param id 预约登记主键
     * @return 结果
     */
    @Override
    public int deleteAppointmentById(String id)
    {
        return appointmentMapper.deleteAppointmentById(id);
    }
}
